# 爬取'https://www.icourse163.org/course/BIT-1001870002?tid=1464038455'中的课程详情
from lxml import etree  
import requests

headers = {
    'authority': 'www.icourse163.org',
    'cache-control': 'max-age=0',
    'sec-ch-ua': '^\\^',
    'sec-ch-ua-mobile': '?0',
    'upgrade-insecure-requests': '1',
    'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36',
    'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
    'sec-fetch-site': 'same-origin',
    'sec-fetch-mode': 'navigate',
    'sec-fetch-user': '?1',
    'sec-fetch-dest': 'document',
    'referer': 'https://www.icourse163.org/course/BIT-1001870002?tid=1464038455',
    'accept-language': 'zh-CN,zh;q=0.9',
    'cookie': 'CLIENT_IP=222.20.85.236; NTESSTUDYSI=9a13f48d9d9441c7a52eb08e5425f9de; EDUWEBDEVICE=6f0ee68ac9a44d449d037e10e66e265e; Hm_lvt_77dc9a9d49448cf5e629e5bebaa5500b=1620530716; __yadk_uid=dFA6XacL7KlykZc5LToZmz0r2QGOLS9X; NTES_YD_SESS=X44tT.SAlKciKAMW5XcyN1a.MCrtoTzjPNvqzF_aBBLVAZ_WA7Kw6g6PpF0L_aogceKfCKPR9RN6h6o6K4YyU7jknUsLq5S4sDKC8meW8M_UMm62T9uG1aLJI4ajxn1HJybCpgLRvHdHgEzFiFsnUExhKOzc9ZNP6WgAiLdxx_wQq0Yr2IRR2eu6ro0nC.kP2FAz1eT8XNgEy.SDWrLwVjz6wf.lBLP69qgmqEcTbnk53; NTES_YD_PASSPORT=zDiybY8e3J8iOpkKO7ZIF7TfvFh1BAuInocxPS8cJC25NK67NXivTdT.A_Cu6bmdhziVFi.WwW3YYk8mo6CTlfIRKyQHgOny8ej78PcFDJQawVqU3Or.IdWmzr6UaKTCOY0zoQgzIjglm54YG9_PfGpkYhbepHrWJl0sMZ2zQp3J8opN8RiwunDttq0Iql1NeZKByMkUejvPEVKC3d7lLM7B2; S_INFO=1620544023^|0^|3&80^#^#^|18571826829; P_INFO=18571826829^|1620544023^|1^|imooc^|00&99^|US&1618926254&study^#US&null^#10^#0^#0^|&0^|null^|18571826829; STUDY_INFO=^\\^yd.f13d5e27bafe41f79^@163.com^|8^|1135858868^|1620544023994^\\^; STUDY_SESS=^\\^bVgiYAmYewA6l8YvVUjDaDSBesHqbbfBw9OauOtbNwypn9Jumx7P2GDBDSCKCFGz/vRlk2SsJVdKSGSHhAKVcgIp2wWoOSoe6AeXJQAUVVVflkCjbNnl6DDkHZNe4Gyx8m49RclMVBLhg397qRSTz5gKkbrGso2DR7quj9DvN9wLhur2Nm2wEb9HcEikV+3FTI8+lZKyHhiycNQo+g+/oA==^\\^; STUDY_PERSIST=^\\^XbWZdTYnK/oZnSgNQ+fHcJqNDqM3eI4Ia8MYlAywFbpmkB0TFdgXm0jlJU4KvS1iI5whnYQ7U0cPpRO8MIhGPI9g1f4SlzQ+ioi7jvJ3rpwfikQrRYWP8W0Qtueva71jxFDatn7TU/IuWqAFGSM4W0H1VGizRXqNXw4vqIFjj4cM6wopp9AonIQD2dZH2G5tof4CY3ecgBSEXLRERdTIuGr/eHDnpOOE0dWGnJTtn+HZgpjCC7Iso4RP9U87vJE8LtaQzUT1ovP2MqtW5+L3Hw+PvH8+tZRDonbf7gEH7JU=^\\^; NETEASE_WDA_UID=1135858868^#^|^#1519567762363; __utma=63145271.1072752111.1620544306.1620544306.1620544306.1; __utmc=63145271; __utmz=63145271.1620544306.1.1.utmcsr=(direct)^|utmccn=(direct)^|utmcmd=(none); WM_NI=hCi^%^2BzZzLcHq^%^2BMJg09^%^2FQ^%^2FllGxahrd1MAklq5CqEFAa^%^2B1Bj0xtGmcA6iIMU^%^2BrU3CphqRuVEs^%^2BlKHMoA9BEAxoFkrwacPF8y6mdLBc194eQ2mGBpjoC^%^2BngXnplPDAozfhRnSG8^%^3D; WM_NIKE=9ca17ae2e6ffcda170e2e6eed0bc33b09da394ae33f4b08fa7d84f939b9abab63bbb96b897cb608fb0a2abd92af0fea7c3b92aac9da7ccf952ba94ada9f4218f96a9d1bc2593f1a48dc674a3b8be85b44783b5a492b849b39b8aa2e421f39ea6d1fb8085b3ada2b5638b939bccf15ff19dc089f45ab78a8b94aa6889988390c433829b8f99ee4ea9aeb982e25c86e8b7d7f070909eadd2bc40a78ffe8ec64ab4b6a1a4aa66a588a291ef5c889fa19be56492b29da8bb37e2a3; WM_TID=J6Qdsdn638BFEEEBBVdqwiXvDNGthtf^%^2B; hasVolume=true; videoVolume=0.8; Hm_lpvt_77dc9a9d49448cf5e629e5bebaa5500b=1620627486',
}
params = (
    ('tid', '1464038455'),
)

res_3 = requests.get('https://www.icourse163.org/course/BIT-1001870002', headers=headers, params=params)
print(res_3.text)
# rxml = etree.HTML(res_3.text)
# rxml.xpath("//div[@id='j-course-heading-intro']/div[@id='j-rectxt2']")
